package com.bt.lms.ui.page.school_education.graduat;

import com.bt.lms.ui.action.school_education.graduat.EditEmploymentAction;
import com.bt.lms.ui.page.sys.style.BtnStyle;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Cursor;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;

/**
 * 就业信息
 */
public class PageEmployment extends VBox {
    private Integer baseWidth = 1230;


    /**
     * 初始化就业信息盒子
     */
    public PageEmployment(){

        //初始化毕业信息盒子
        this.setPrefWidth(1200);
        VBox totalVBox = new VBox();
        Insets insets = new Insets(10);
        totalVBox.setPadding(insets);
        totalVBox.setPrefWidth(1200);

        HBox mesHBox = new HBox();
        mesHBox.setSpacing(600);
        Label studentBasic = new Label("招生计划A-班级1-灭霸学员就业信息");
        studentBasic.setFont(Font.font("圆体", 20));
        mesHBox.getChildren().addAll(studentBasic);
        totalVBox.getChildren().add(mesHBox);

        Label statusBasicMes = new Label("就业信息");
        statusBasicMes.setFont(Font.font("圆体",20));
        HBox hBox1 = new HBox();
        hBox1.setPrefWidth(1230);
        hBox1.setStyle("-fx-background-color: #cec9c9");
        hBox1.getChildren().add(statusBasicMes);
        totalVBox.getChildren().add(hBox1);
        totalVBox.setSpacing(10);

        ScrollPane scrollPane = new ScrollPane();
        scrollPane.setPrefWidth(1280);
        //设置滚动盒子只有竖向
        scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
        scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);

        HBox hBox = new HBox();
        hBox.setPrefWidth(baseWidth);
        Insets insets1 = new Insets(0,50,0,10);
        hBox.setPadding(insets1);
        hBox.setAlignment(Pos.CENTER_RIGHT);
        Button editBtn = new Button("💻编辑");
        hBox.getChildren().add(editBtn);
        totalVBox.getChildren().add(hBox);
        //按钮样式
        BtnStyle.saveBtn(editBtn);
        editBtn.setCursor(Cursor.HAND);

        //基本信息的主盒子
        VBox vBox = initGraduatInfo();
        totalVBox.getChildren().add(vBox);

        //给编辑按钮加事件
        EditEmploymentAction editEmploymentAction = new EditEmploymentAction(totalVBox,baseWidth,vBox);
        editBtn.setOnAction(editEmploymentAction);

        scrollPane.setContent(totalVBox);
        this.getChildren().add(scrollPane);
    }

    /**
     * 初始化就业信息盒子
     * @return
     */
    private VBox initGraduatInfo(){
        VBox vBox = new VBox();
        vBox.setPrefWidth(baseWidth);
        vBox.setSpacing(10);


        HBox one = new HBox();
        one.setPrefWidth(baseWidth);
        one.setSpacing(10);
        Label firmLab = new Label("公司名");
        firmLab.setPrefWidth(baseWidth/8);
        Label firmTF = new Label();
        firmTF.setPrefWidth(baseWidth/4);
        Label firmSiteLab = new Label("公司地址");
        firmSiteLab.setPrefWidth(baseWidth/8);
        HBox siteHBox = new HBox();
        Label provinceLab = new Label();//省
        provinceLab.setPrefWidth(50);
        Label cityLab = new Label();//市
        cityLab.setPrefWidth(50);
        Label countyLab = new Label();//县
        countyLab.setPrefWidth(70);
        Label detailedLab = new Label();//详细地址
        siteHBox.getChildren().addAll(provinceLab,cityLab,countyLab,detailedLab);
        one.getChildren().addAll(firmLab,firmTF,firmSiteLab,siteHBox);


        HBox two = new HBox();
        two.setPrefWidth(baseWidth);
        two.setSpacing(10);
        Label signedLab = new Label("协议签订日期");
        signedLab.setPrefWidth(baseWidth/8);
        Label signedDP = new Label();
        signedDP.setPrefWidth(baseWidth/4);
        Label registerLab = new Label("报到日期");
        registerLab.setPrefWidth(baseWidth/8);
        Label registerDP = new Label();
        registerDP.setPrefWidth(baseWidth/4);
        two.getChildren().addAll(signedLab,signedDP,registerLab,registerDP);

        HBox three = new HBox();
        three.setPrefWidth(baseWidth);
        three.setSpacing(10);
        Label firmTypeLab = new Label("企业类型");
        firmTypeLab.setPrefWidth(baseWidth/8);
        Label firmTypeCB = new Label();
        firmTypeCB.setPrefWidth(baseWidth/4);
        three.getChildren().addAll(firmTypeLab,firmTypeCB);


        HBox four = new HBox();
        four.setPrefWidth(baseWidth/4);
        four.setSpacing(10);
        Label firmDescribeLab = new Label("公司描述");
        firmDescribeLab.setPrefWidth(baseWidth/8);
        Label firmDescribeTA = new Label();
        firmDescribeTA.setPrefWidth(baseWidth/4);
        four.getChildren().addAll(firmDescribeLab,firmDescribeTA);


        vBox.getChildren().addAll(one,two,three,four);


        return vBox;
    }

}
